package com.alibaba.mapper;

import com.alibaba.bean.PostNote;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface PostMapper {

    @Insert(value = "insert into forum(userId,content,imgList,replyNum,likeNum) values(#{userId},#{content},#{imgList},0,0)")
    //@Options(useGeneratedKeys = true,keyProperty = "forumId",keyColumn = "forumId")
    void saveNote(PostNote postNote);

    @Select(value = "select f.userId,f.content,f.imgList from forum f where f.userId=#{userId} order by f.forumId DESC limit 0,1")
    PostNote checkSave(int userId);

}
